<?php defined('SYSPATH') or die('No direct script access.');
 
class Controller_Lang extends Controller {
 
    public function before() 
    {
        parent::before();
        
        $lang = $this->request->action();
        
        if(in_array($lang, Kohana::config('main')->available_languages))
        {
            //I18n::lang($lang);
            setcookie("lang", $lang,31536000 + time(),'/');
            $this->request->redirect($this->request->referrer());
        }
        else
            throw new HTTP_Exception_404;
    }
 
    public function action_index()
    {
 
    }
}
?>